<!DOCTYPE html>
<!--
@name:
@description:
@author: lzy
@title: 天王盖地虎!!!
@time: 2021-03-26 14:04:48
-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
	<link rel="stylesheet" type="text/css" href="bootstrap-dist/css/bootstrap.css" />
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
	
</head>
<body>
<div class="container mt-5">
	<div class="row">
		<img src="logo/mianxingzhangben%20(1).svg" style="display: block" class="m-auto" alt="">
	</div>
	<div class="row">
		<form class="col-sm-12 col-lg-5 mt-sm-5 m-lg-auto" method="post" action="">
			<div class="form-group">
				<label for="username">请输入账号</label>
				<input type="number" class="form-control" id="username" >
				<small id="emailHelp" class="form-text text-muted">我们不会泄露您的隐私</small>
			</div>
			<div class="form-group">
				<label for="password">请输入密码</label>
				<input type="password" class="form-control" id="password">
			</div>
			<div class="form-group form-check">
				<input type="checkbox" class="form-check-input" id="isAllowed">
				<label class="form-check-label" for="isAllowed"><a href="">同意用户协议</a></label>
				<small class="form-text text-muted text-right">还没有账号？点击 <a href="regist.html">注册</a></small>
			</div>
			<button type="button" style="display: block" class="btn m-auto col-10  btn-primary" id="myRequest">登录</button>
		</form>
	</div>
</div>
</body>
<script src="bootstrap-dist/js/jquery-3.5.1.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap-dist/js/popper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script>
$(function () {
	$("#loginfail").hide();
        $("#myRequest").click(function () {        	
            $.ajax({
                type:"post",
                url: "http://192.168.162.26:8080/user", // 要访问的地址，这里访问的是servlet映射地址
                data:{
                	"username":$("#username").val(),
					"password":$("#password").val(),
					"opr":"login"
				},
                dataType:"json",
				success:function (result) {
					console.log(result);
					let jsonStr = JSON.stringify(result);
					if (result.username!=null){
						window.location.href="main.html";
					}else {
						mui.toast("登录失败，用户名或密码错误！")
					}
				}
               
            })
			
        })
    })
</script>
</html>